home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- 1/89
-
- DIRK v2.0 -- Tune workbench colors to system performance
-
- Copyright (C) 1989 by Daniel Elbaum
-
- This software is freely redistributable provided that:
- the four files which comprise it (dirk, dirk.doc, dirk.h,
- adjust.c, main.c, sys, window.c) remain intact; all
- copyright notices contained in any of the aforementioned
- files remain intact; and no fee beyond reasonable remuneration
- for collation and distribution be charged for use and/or
- distribution.
-
- ***************************************************************************/
-
-
- #include "dirk.h"
-
- getargs(v, f)
- char **v;
- t_gf *f;
- {
- register out=0;
-
- f->gran = 4; /* good when 4-5 processes are in background */
- f->dsmax = 12; /* takes some glare out of text */
- f->dsmin = 8; /* readable even at near-red */
- f->dstog = 1; /* task watcher on by default */
- f->bstog = 1; /* memory watcher on by default */
- f->intvl = 180; /* default delay is 3 seconds */
- f->bd_r = 2; /* increment for detail pen red */
- f->bd_g = 2; /* increment for detail pen green */
- f->bd_b = 0; /* increment for detail pen blue */
-
- f->hb_r = 14; /* go from blue 14 to red 14 as memory fills */
- f->hb_g = 0;
- f->hb_b = 0;
- f->lb_r = 0;
- f->lb_g = 0;
- f->lb_b = 14;
-
- while (*v){
- if (**v=='-') {
- if (!(*v)[1]) return(usage());
- while (*++*v){
- switch(**v){
- case 'g': f->gran=atoi(++*v); ++out; break;
- case 'h': f->dsmax=atoi(++*v); ++out; break;
- case 'l': f->dsmin=atoi(++*v); ++out; break;
- case 'i': f->intvl=atoi(++*v); ++out; break;
- case 't': f->bstog=0; break;
- case 'm': f->dstog=0; break;
- case 'd':
- switch(*++*v){
- case 'r': f->bd_r=atoi(++*v); ++out; break;
- case 'g': f->bd_g=atoi(++*v); ++out; break;
- case 'b': f->bd_b=atoi(++*v); ++out; break;
- default: return(usage());
- }
- break;
- case 'e':
- switch(*++*v){
- case 'r': f->lb_r=atoi(++*v); ++out; break;
- case 'g': f->lb_g=atoi(++*v); ++out; break;
- case 'b': f->lb_b=atoi(++*v); ++out; break;
- default: return(usage());
- }
- break;
- case 'f':
- switch(*++*v){
- case 'r': f->hb_r=atoi(++*v); ++out; break;
- case 'g': f->hb_g=atoi(++*v); ++out; break;
- case 'b': f->hb_b=atoi(++*v); ++out; break;
- default: return(usage());
- }
- break;
- default: return(usage());
- } /* switch (**v) */
- if (out) {++v; break;}
- } /* while (*++*v) */
- if (!out) ++v;
- else out=0;
- } /* else if (**v=='+') */
- else {
- return(usage());
- }
- } /* while (*v) */
- limit(f);
- if (f->gran==0) f->gran=1; /* special case for x/gran */
- return(0);
- }
-
- #define LFIX(x, l) if (x<l) x=l
- #define HFIX(x, h) if (x>h) x=h
-
- /*
- Make sure all members of *f are in bounds.
- */
-
- limit(f)
- t_gf *f;
- {
- int tmp;
- int maxint=(1<<sizeof(maxint))-1;
-
-
- LFIX(f->gran, 0);
- HFIX(f->gran, maxint);
- LFIX(f->dsmax, 0);
- HFIX(f->dsmax, CMAX);
- LFIX(f->dsmin, 0);
- HFIX(f->dsmin, CMAX);
- LFIX(f->intvl, 0);
- HFIX(f->intvl, maxint);
-
- LFIX(f->bd_r, 0);
- HFIX(f->bd_r, CMAX);
- LFIX(f->bd_g, 0);
- HFIX(f->bd_g, CMAX);
- LFIX(f->bd_b, 0);
- HFIX(f->bd_b, CMAX);
-
- LFIX(f->lb_r, 0);
- HFIX(f->lb_r, CMAX);
- LFIX(f->lb_g, 0);
- HFIX(f->lb_g, CMAX);
- LFIX(f->lb_b, 0);
- HFIX(f->lb_b, CMAX);
-
- LFIX(f->hb_r, 0);
- HFIX(f->hb_r, CMAX);
- LFIX(f->hb_g, 0);
- HFIX(f->hb_g, CMAX);
- LFIX(f->hb_b, 0);
- HFIX(f->hb_b, CMAX);
-
- /* db may be negative */
-
- f->db_r = f->hb_r-f->lb_r;
- f->db_g = f->hb_g-f->lb_g;
- f->db_b = f->hb_b-f->lb_b;
- }
-
- usage()
- {
- printf("Dirk v2.0 copyright (c) 1989 Daniel Elbaum\n");
- printf("\nUsage: dirk [-t|m] [-gN] [-hN] [-lN] [-iN]]...\n");
- printf("t\ttrack tasks only\n");
- printf("m\ttrack memory only\n");
- printf("g (4)\tgranularity of task mapping (small for few tasks)\n");
- printf("h (12)\tmaximum detail saturation\n");
- printf("l (8)\tminimum detail saturation\n");
- printf("i (180)\tinterval in ticks (60 or 50 per second)\n");
- printf("\n...");
- printf("\t[-drN] [-dgN] [-dbN] [-erN] [-egN] [-ebN] [-frN] [-fgN] [-fbN]\n");
- printf("dr (2)\tamount by which to redden the detail pen\n");
- printf("dg (2)\tamount by which to greeen the detail pen\n");
- printf("db (0)\tamount by which to bluen the detail pen\n");
- printf("er (0)\tamount of red for empty memory\n");
- printf("eg (0)\tamount of green for empty memory\n");
- printf("eb (14)\tamount of blue for empty memory\n");
- printf("fr (14)\tamount of red for full memory\n");
- printf("fg (0)\tamount of green for full memory\n");
- printf("fb (0)\tamount by blue for full memory\n");
- return(-1);
- }
-
-
-